Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#2123 closed enhancement (fixed)

[raster] ST_FromGDALRaster

Reported by: robe Owned by: dustymugs
Priority: medium Milestone: PostGIS 2.1.0
Component: raster Version: master
Keywords: history Cc:

Description

This I'm envisioning as a companion functions to ST_AsGDALRaster.

http://www.postgis.org/documentation/manual-svn/RT_ST_AsGDALRaster.html

It would take a bytea object and return a set of type raster.

One specific use case. I have this web service where people can upload drawings and other rasters like pictures and so forth. Ideally I want to bring them in as postgis raster so I can use all the postgis plumbing to do things like extrude features, resize as needed and for some cases georeference based on associated objects in the database and so forth.

I want it to return a set of raster rather than a single raster just because I may need it tiled in some cases and possibly because resulting size of a single might exceed our row limits.

Format I'm thinking would be:

ST_FromGDALRaster(bytea gdal_rast, text[] options=NULL, integer srid=sameassource);

options would vary depending on raster type. I'm assuming from the header of the gdal_rast blob we can infer the gdal type or have that passed in in the options arg? Or does this need to be passed in? Not sure how raster2pgsql does it. I guess if it can never infer we would pass in as a separate arg.

Change History (6)

comment:1 by dustymugs, 12 years ago

Interesting function. The only question I have is whether or not GDAL will accept a binary blob not in a file. I'll have to do some digging.

raster2pgsql just passes on each input file to GDAL and GDAL does the inferring…

comment:2 by rouault, 12 years ago

Most GDAL drivers can work with a in-memory file, thanks to the /vsimem/ virtual file system. See http://www.gdal.org/cpl__vsi_8h.html#af9c1b931449d423e7a80bacb75ff0717

comment:3 by dustymugs, 12 years ago

Summary: ST_FromGDALRaster[raster] ST_FromGDALRaster

Thanks for the advice, rouault!

comment:4 by dustymugs, 12 years ago

Milestone: PostGIS FuturePostGIS 2.1.0
Resolution: fixed
Status: newclosed

Added the following in r11202.

ST_FromGDALRaster(gdaldata bytea, srid integer DEFAULT NULL)

No ideas what kind of options are possible so I didn't add that parameter.

comment:5 by robe, 12 years ago

Cool - can't wait to try it out. I even mentioned it in chapter 7 that it was coming in 2.1, guess I'll have to sneak in an example. See you later today. :)

comment:6 by dustymugs, 12 years ago

Keywords: history added
Note: See TracTickets for help on using tickets.